package com.youxue.teachin.set.child.area;

import java.util.List;

import com.library.rest.ApiServiceManager;
import com.library.rest.rxjava.RxResultHelper;
import com.library.rest.rxjava.RxSchedulersHelper;
import com.library.rest.vo.ResponseModel;
import com.youxue.teachin.set.child.area.vo.AreaVO;
import rx.Observable;

/**
 * 在此写用途
 *
 * @author: zhiwei
 * @date: 2017-10-07 18:07
 * @version: 9.1.0
 */
public class AreaUserCase {
    private final IAreaRepository mRepository;

    public AreaUserCase() {
        Class<IAreaRepository> claxx = IAreaRepository.class;
        mRepository = ApiServiceManager.getOrCreateApiService(claxx);
    }

    public Observable<List<AreaVO>> getAreasInfo(){
        return mRepository.getAreasInfo()
            .compose(RxSchedulersHelper.<ResponseModel<List<AreaVO>>>io_main())
            .compose(RxResultHelper.<List<AreaVO>>handleResult());
    }
}
